<?php

namespace xing\verify;

use xing\verify\drive\Ali365VerifyMobile;
use xing\verify\drive\BackgroundCheckAliAnNa;

class VerifyFactory
{

    private static $drive = [
        'mobileAli365' => '\xing\verify\drive\Ali365VerifyMobile',
        'backgroundCheckAliAnNa' => '\xing\verify\drive\BackgroundCheckAliAnNa',
    ];

    /**
     * 返回单例
     * @param $instanceName
     * @param array $config
     * @return Ali365VerifyMobile|BackgroundCheckAliAnNa
     */
    public static function getInstance($instanceName, $config = [])
    {
        static $class;
        if (isset($class[$instanceName])) return $class[$instanceName];
        return $class[$instanceName] = (new self::$drive[$instanceName])->init($config);
    }
}
